package com.ocean.common.utils;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

/**
 * @Author: FuGui Wang
 * @Description: ftp配置类
 * @Date 2023/3/15
 * @Version V1.1.0
 */
@Configuration
@Component
public class JYFTPProperties implements InitializingBean {

    /**
     * 服务器ip
     */
    @Value("${jyftp.ftp-ip}")
    private String ftpIp;

    /**
     * 服务器端口
     */
    @Value("${jyftp.ftp-port}")
    private int ftpPort;

    /**
     * 账号名
     */
    @Value("${jyftp.ftp-username}")
    private String ftpUsername;

    /**
     * 密码
     */
    @Value("${jyftp.ftp-password}")
    private String ftpPassword;

    public static String FTP_IP;
    public static int FTP_PORT;
    public static String FTP_USERNAME;
    public static String FTP_PASSWORD;
     /**
     * 远程目录
     */
    public static String FTP_REMOTE_PATH;

     /**
     * 远程目录
     */
    @Value("${jyftp.remote-path}")
    private String remotePath;

    @Override
    public void afterPropertiesSet() throws Exception {
        FTP_IP = ftpIp;
        FTP_PORT = ftpPort;
        FTP_USERNAME = ftpUsername;
        FTP_PASSWORD = ftpPassword;
        // 远程目录
        FTP_REMOTE_PATH = remotePath;
    }
}